package cn.sail.spring.ioc.configurations;

import cn.sail.spring.ioc.service.CatService;
import cn.sail.spring.ioc.service.impl.CatServiceImpl;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

/**
 * 3
 * 配置文件类
 * 要加载的类的说明配置
 * =spring-context.xml
 * 告诉spring 要加载哪些类型
 */
@Configuration
public class BeanConfigurations {

    /**
     * <bean id="userService" class="cn.sail.spring.ioc.service.impl.UserServiceImpl"></bean>
     * <bean id="walletService" class="cn.sail.spring.ioc.service.impl.WalletServiceImpl"></bean>
     */
    @Bean
    @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
//    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
    public CatService catService() {
        System.out.println("BeanConfigurations catService");
        return new CatServiceImpl();
    }


}
